﻿namespace WMS6.Web
{
    using System;
    using System.Collections;
    using System.Web;
    using System.Web.SessionState;

    public class FilterChain
    {
        private HttpApplication application;
        private IEnumerator filterEnumerator;

        public FilterChain(HttpApplication application, IEnumerator filterEnumerator)
        {
            this.application = application;
            this.filterEnumerator = filterEnumerator;
        }

        public void DoFilter()
        {
            if (this.filterEnumerator.MoveNext())
            {
                ((IFilter) this.filterEnumerator.Current).DoFilter(this);
            }
        }

        public HttpApplicationState Application
        {
            get
            {
                return this.application.Application;
            }
        }

        public HttpRequest Request
        {
            get
            {
                return this.application.Request;
            }
        }

        public HttpResponse Response
        {
            get
            {
                return this.application.Response;
            }
        }

        public HttpServerUtility Server
        {
            get
            {
                return this.application.Server;
            }
        }

        public HttpSessionState Session
        {
            get
            {
                return this.application.Session;
            }
        }

        public string Url
        {
            get
            {
                return this.application.Request.Url.ToString();
            }
        }
    }
}

